﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ISMOT.HCI.KGL
{
    public class JointPositionCollection : ICollection<JointPosition>
    {
        public JointPositionCollection()
        {
            this.InternalCollection = new List<JointPosition>();
        }

        private List<JointPosition> InternalCollection { get; set; }

        public void Add(JointPosition item)
        {
            var index = this.InternalCollection.IndexOf(item);

            if (index < 0)
                this.InternalCollection.Add(item);
            else
            {
                this.InternalCollection[index] = item;
            }
        }

        public void Clear()
        {
            this.InternalCollection.Clear();
        }

        public bool Contains(JointPosition item)
        {
            return (this.InternalCollection.Contains(item));
        }

        public void CopyTo(JointPosition[] array, int arrayIndex)
        {
            this.InternalCollection.CopyTo(array, arrayIndex);
        }

        public int Count
        {
            get { return (this.InternalCollection.Count); }
        }

        public bool IsReadOnly
        {
            get { return (false); }
        }

        public bool Remove(JointPosition item)
        {
            return (this.InternalCollection.Remove(item));
        }

        public IEnumerator<JointPosition> GetEnumerator()
        {
            return (this.InternalCollection.GetEnumerator());
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return (this.InternalCollection.GetEnumerator());
        }
    }
}
